# tan3cb$s17q3_rand
# tan3cb$s17q3
# tan3cb$s17q4
# tan3cb$s17q1
# tan3cb$s17q2

tan3 <- 
  tan3 %>% 
  mutate(
    # Female
    female = as.numeric(resp_gender == 1),
    s17q3_rand = as.numeric(s17q3_rand),
    # Gender of victim in vignette (randomly assigned)
    female_victim = ifelse(s17q3_rand > 0.5, 1, 0),
    beat_thief_woman = case_when(s17q4 ==1 ~ 1,
                                 s17q4 ==2 ~ 0,
                                 TRUE ~ NA_real_),
    beat_thief_man = case_when(s17q3 ==1 ~ 1,
                               s17q3 ==2 ~ 0,
                               TRUE ~ NA_real_),
    # Support for mob violence
    beat_thief = ifelse(female_victim ==1, beat_thief_woman, beat_thief_man),
    # Community judgement of guilt
    accusation_not_true = case_when(s17q1 == 1 ~0, 
                                    s17q1 == 2 ~ 1,
                                    TRUE ~ NA_real_),
    # Fear of false accusations
    afraid_accusation = case_when(s17q2 %in% c(1,2) ~ 1, 
                                  s17q2 %in% c(3,4) ~ 0,
                                  TRUE ~ NA_real_))




  